/* Ejercicio 5.21: ejer5_21.c
   Drawing shapes with characters */
#include <stdio.h>

/* Prototypes */
void printSquare( int side, char fillCharacter );
void printTriangle( int side, char fillCharacter );

/* function main begins program execution */
int main( void )
{
    printSquare( 5, '#' );
    printSquare( 5, '*' );
    printTriangle( 4, '$');

	return 0;
} /* end function main */

/* prints a square of a side with the fillCharacter */
void printSquare( int side, char fillCharacter )
{
    int i, j;

    for ( i = 1; i <= side; i++ ) {

        for ( j = 1; j <= side; j++ ) {
            printf( "%c", fillCharacter );
        }

        printf( "\n" );
    }
} /* end function printSquare */

void printTriangle( int side, char fillCharacter )
{
    int i, j;

    for ( i = 1; i <= side; i++ ) {

        for ( j = 1; j <= i; j++ ) {
            printf( "%c", fillCharacter );
        }

        printf( "\n" );
    }
}
